fix: use correct 'content' key in sandbox code executor input files#5505
fix: use correct 'content' key in sandbox code executor input files#5505weiguangli-io wants to merge 2 commits into
Conversation
Fixes google#5500. The input file payload used 'contents' (plural) but the Vertex AI SDK reads 'content' (singular), causing uploaded files to arrive as zero bytes in the sandbox with no error raised.
|
Response from ADK Triaging Agent Hello @weiguangli-io, thank you for creating this PR! This PR is a bug fix, could you please include a In addition, could you please provide logs or screenshot after the fix is applied? This information will help reviewers to review your PR more efficiently. Thanks! |
|
Hi @weiguangli-io , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share. |
|
Hi @sasha-gitg , can you please review this. |
Verifies that AgentEngineSandboxCodeExecutor sends input_files with the 'content' key (singular), matching what the Vertex AI Sandbox API expects. Without this fix, file.get('content', b'') returns empty bytes and all input files are silently created empty.
Ref: google#5500, google#5505, google#5824
…t files
The AgentEngineSandboxCodeExecutor builds input file payloads with key 'contents' (plural), but the Vertex AI SDK reads 'content' (singular). This causes file.get('content', b'') to always return empty bytes — all input files are silently created as zero bytes in the sandbox with SUCCESS status returned.
Fixes the same root cause as PR google#5505 which fixed this in other files but missed agent_engine_sandbox_code_executor.py.
Ref: google#5500, google#5505, google#5824
Verifies that AgentEngineSandboxCodeExecutor sends input_files with the 'content' key (singular), matching what the Vertex AI Sandbox API expects. Without this fix, file.get('content', b'') returns empty bytes and all input files are silently created empty.
Ref: google#5500, google#5505, google#5824
Merge #5505 Fixes #5500 ### Root Cause `AgentEngineSandboxCodeExecutor` builds the input file payload with key `'contents'` (plural), but the Vertex AI SDK (`vertexai/_genai/sandboxes.py`) reads `'content'` (singular). This causes `file.get("content", b"")` to always return the default empty bytes, so uploaded input files silently arrive as zero bytes in the sandbox. ### Fix One-character change: `'contents'` → `'content'` at line 177. Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 930814004
|
Thank you @weiguangli-io for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit 6262f94. Closing this PR as the changes are now in the main branch. |
Fixes #5500
Root Cause
AgentEngineSandboxCodeExecutorbuilds the input file payload with key'contents'(plural), but the Vertex AI SDK (vertexai/_genai/sandboxes.py) reads'content'(singular). This causesfile.get("content", b"")to always return the default empty bytes, so uploaded input files silently arrive as zero bytes in the sandbox.Fix
One-character change:
'contents'→'content'at line 177.